package com.cmsky.open.cms.model;

import javax.validation.constraints.*;
import org.hibernate.validator.constraints.*;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

import java.util.*;

import com.cmsky.open.core.base.*;
import com.cmsky.open.core.util.*;

import cn.org.rapid_framework.util.*;
import cn.org.rapid_framework.web.util.*;
import cn.org.rapid_framework.page.*;
import cn.org.rapid_framework.page.impl.*;

import com.cmsky.open.cms.model.*;
import com.cmsky.open.cms.dao.*;
import com.cmsky.open.cms.enums.CmsNodePropertyKey;
import com.cmsky.open.cms.manager.*;
import com.cmsky.open.cms.vo.query.*;

/**
 * @author jandyfish email:jandyfish(a)gmail.com
 * @version 1.0
 * @since 1.0
 */


public class CmsNodeInfo extends BaseEntity implements java.io.Serializable,Cloneable{
	private static final long serialVersionUID = 5454155825314635342L;
	
	//alias
	public static final String TABLE_ALIAS = "CmsNodeInfo";
	public static final String ALIAS_ID = "编号";
	public static final String ALIAS_NAME = "名称";
	public static final String ALIAS_TYPE = "类型";
	public static final String ALIAS_PID = "父节点";
	public static final String ALIAS_SID = "位置";
	public static final String ALIAS_VALID = "有效性";
	
	//date formats
	
	//可以直接使用: @Length(max=50,message="用户名长度不能大于50")显示错误消息
	//columns START
    /**
     * 编号       db_column: id 
     */	
	
	private java.lang.Integer id;
    /**
     * 名称       db_column: name 
     */	
	@NotBlank @Length(max=20)
	private java.lang.String name;
    /**
     * 类型       db_column: type 
     */	
	@NotNull @Max(127)
	private Integer type;
    /**
     * 父节点       db_column: pid 
     */	
	@NotNull 
	private java.lang.Integer pid;
    /**
     * 位置       db_column: sid 
     */	
	@NotNull 
	private java.lang.Integer sid;
    /**
     * 有效性       db_column: valid 
     */	
	@NotNull @Max(127)
	private Integer valid;
	//columns END

	public CmsNodeInfo(){
	}

	public CmsNodeInfo(
		java.lang.Integer id
	){
		this.id = id;
	}

	public void setId(java.lang.Integer value) {
		this.id = value;
	}
	
	public java.lang.Integer getId() {
		return this.id;
	}
	public void setName(java.lang.String value) {
		this.name = value;
	}
	
	public java.lang.String getName() {
		return this.name;
	}
	public void setType(Integer value) {
		this.type = value;
	}
	
	public Integer getType() {
		return this.type;
	}
	public void setPid(java.lang.Integer value) {
		this.pid = value;
	}
	
	public java.lang.Integer getPid() {
		return this.pid;
	}
	public void setSid(java.lang.Integer value) {
		this.sid = value;
	}
	
	public java.lang.Integer getSid() {
		return this.sid;
	}
	public void setValid(Integer value) {
		this.valid = value;
	}
	
	public Integer getValid() {
		return this.valid;
	}
	private CmsNodeInfo parent;
	
	Map<CmsNodePropertyKey,String> properties;
	
	public CmsNodeInfo getParent() {
		return parent;
	}

	public void setParent(CmsNodeInfo parent) {
		this.parent = parent;
	}
	
	public Map<CmsNodePropertyKey, String> getProperties() {
		return properties;
	}

	public void setProperties(Map<CmsNodePropertyKey, String> properties) {
		this.properties = properties;
	}

	public String toString() {
		return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
			.append("Id",getId())
			.append("Name",getName())
			.append("Type",getType())
			.append("Pid",getPid())
			.append("Sid",getSid())
			.append("Valid",getValid())
			.toString();
	}
	
	public int hashCode() {
		return new HashCodeBuilder()
			.append(getId())
			.toHashCode();
	}
	
	public boolean equals(Object obj) {
		if(obj instanceof CmsNodeInfo == false) return false;
		if(this == obj) return true;
		CmsNodeInfo other = (CmsNodeInfo)obj;
		return new EqualsBuilder()
			.append(getId(),other.getId())
			.append(getName(),other.getName())
			.append(getType(),other.getType())
			.append(getPid(),other.getPid())
			.append(getSid(),other.getSid())
			.append(getValid(),other.getValid())
			.isEquals();
	}
	
	 public CmsNodeInfo clone(){
	        CmsNodeInfo o = null;
	        try{
	            o = (CmsNodeInfo)super.clone();
	        }catch(CloneNotSupportedException e){
	            e.printStackTrace();
	        }
	        return o;
	 }
}

